extern "C" { 
    #include "apue.h" 
}   
#include <stdio.h>

#include <unistd.h>
#include <fcntl.h>


#include <unistd.h>
// int access(const char *pathname, int mode);
// #include <fcntl.h>           /* Definition of AT_* constants */
// #include <unistd.h>
// int faccessat(int dirfd, const char *pathname, int mode, int flags);
int main(int argc ,char** argv)
{    
    if(argc==1)
    {
        err_quit("pls input file path\n");
    }
    if(-1== access(argv[1], R_OK))
    {
        printf("real id access read error\n");
    }
    else
    {
        printf("real id access read ok\n");
    }

    if(open(argv[1],O_RDONLY))
    {
        printf("effective id access read ok\n");
    }
    else
    {
        printf("effective id access read error\n");
    }
    
    
    exit(0);

}